import React from "react";
import Container from "../components/Base/Container";
import { List, Tabs, WhiteSpace, Badge, Picker, Switch } from "antd-mobile";
import { hashHistory } from "dva/router";
import MyIcon from '../components/Base/MyIcon';
import VipListShow from '../components/Base/VipListShow';
import request from '../utils/request';
import { connect } from 'dva';


const Item = List.Item;

class WiFiHelperFu extends React.Component {
    constructor() {
        super();

        this.state = {
            total: 0,
            reception: 0,
            unReception: 0,
            consume: 0,
        };
    }

    componentDidMount() {
        const {branchNo, shopId} = this.props.currentUser;
        const self = this;
        request("/wifiAide", {
            params: {
                branchNo,
                shopId,
            },
        })
            .then((data) => {
                self.setState({
                    total: data.data.total,
                    consume: data.data.consume,
                    reception: data.data.reception,
                    unReception: data.data.unReception,
                });
            });
    }

    render() {
        return (
            <Container title="WIFI 助手">
        <List renderHeader={() => "今日进店" + this.state.total + "人"}>
          <Item
            arrow="horizontal"
            extra={this.state.reception + "人"}
            onClick={() => {
                hashHistory.push({
                    pathname: '/wifipeoplelist',
                    query: {
                        type: "reception",
                    },
                });
            }}
            >
            已接待
          </Item>

          <Item
            arrow="horizontal"
            extra={this.state.unReception + "人"}
            onClick={() => {
                hashHistory.push({
                    pathname: '/wifipeoplelist',
                    query: {
                        type: "unReception",
                    },
                });
            }}
            >
            未接待
          </Item>

          <Item
            arrow="horizontal"
            extra={this.state.consume + "人"}
            onClick={() => {
                hashHistory.push({
                    pathname: '/wifipeoplelist',
                    query: {
                        type: "consume",
                    },
                });
            }}
            >
            已消费
          </Item>
        </List>
      </Container>
        );
    }
}

export default connect(
    (state) => {
        return {
            currentUser: state.auth.currentUser,
        };
    },
)(WiFiHelperFu);
